/**
 * api方法
 */
import {request} from '@utils/http'
import { IHospitalSetItem, IHospitalSetParams, IHospitalSetPostData, IHospitalSetResponse } from "./model/hospitalSetTypes";
/**
 * 获取医院设置分页列表数据
 * @param param 
 * @returns Promise<IHospitalSetResponse>
 */
export const getHospitalSetList = ({page,limit,hosname,hoscode}: IHospitalSetParams)=>{
    return request.get<any, IHospitalSetResponse>(`/admin/hosp/hospitalSet/${page}/${limit}`, {
        params:{
            hosname,
            hoscode
        }
    })
}
/**
 * 添加医院
 * @param data ： 医院设置请求体数据
 * 
 */
export const addHospitalSet = (data:IHospitalSetPostData)=>{
    return request.post<any,null>('/admin/hosp/hospitalSet/save',data)
}
/**
 * 根据id获取医院数据
 * @param id 
 * @returns 
 */
export const getHospitalSetById = (id:string)=>{
    return request.get<any, IHospitalSetItem>('/admin/hosp/hospitalSet/get/' + id)
}
/**
 * 编辑医院设置
 * @param data 
 * @returns 
 */
export const updateHospitalSet = (data:IHospitalSetItem)=>{
    return request.put<any,null>('/admin/hosp/hospitalSet/update', data)
}
/**
 * 根据id删除医院设置接口
 * @param id 
 * @returns 
 */
export const deleteHospitalSetItem = (id:string | number) =>{
    return request.delete<any,null>('/admin/hosp/hospitalSet/remove/' + id)
}

/**
 * 根据id的数组，进行批量删除操作
 * @param ids 
 * @returns 
 */
export const batchRemove = (ids:React.Key[])=>{
    return request.delete<any,null>('/admin/hosp/hospitalSet/batchRemove', {
        data:ids
    })
}